package com.woniuxy.service.impl;

import com.woniuxy.dao.RbacManagerDao;
import com.woniuxy.entity.RbacManager;
import com.woniuxy.service.RbacManagerService;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Author: 马宇航
 * @Todo: manager用户管理的service 此时，我们的spring还不认识他，注册到ioc容器中！
 * @DateTime: 22/03/29/0029 上午 10:54
 * @Component: 成都蜗牛学苑
 **/
public class RbacManagerServiceImpl implements RbacManagerService {
    RbacManagerDao rbacManagerDao;

    public void setRbacManagerDao(RbacManagerDao rbacManagerDao) {
        this.rbacManagerDao = rbacManagerDao;
    }

    @Override
    @Transactional(propagation = Propagation.REQUIRED)
    public int addOne(RbacManager rbacManager) {
        int i = rbacManagerDao.addOne(rbacManager);
        deleteOne(31);
        return i;
    }

    @Override
    public List<RbacManager> findAll() {
        return rbacManagerDao.findAll();
    }

    @Override
    @Transactional(propagation=Propagation.SUPPORTS)
    public int deleteOne(int id) {
        int i = rbacManagerDao.deleteOne(id);
        int j = 1/0;
        return i;
    }

    @Override
    public int updateOne(RbacManager rbacManager) {
        return rbacManagerDao.updateOne(rbacManager);
    }
}
